package cn.cxj.user.service.impl;

import cn.cxj.basic.service.impl.BaseServiceImpl;
import cn.cxj.user.domain.Logininfo;
import cn.cxj.user.domain.User;
import cn.cxj.user.domain.UserAddress;
import cn.cxj.user.mapper.UserAddressMapper;
import cn.cxj.user.mapper.UserMapper;
import cn.cxj.user.service.IUserAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserAddressServiceImpl extends BaseServiceImpl<UserAddress> implements IUserAddressService {

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private UserAddressMapper userAddressMapper;

    @Override
    public List<UserAddress> queryByUserId(Logininfo logininfo) {
        User user = userMapper.loadByLogininfoId(logininfo.getId());
        return userAddressMapper.loadByUserId(user.getId());
    }
}
